#include "kukarsiudpserverdll.h"
#include "kukarsiudpserverdll_global.h"

static KuKaRsiUdpServerDLL* KuKaRsiUdpServerInstance = nullptr;


bool COM_ComKuKaRsiUdpServerInstanceExist(){
    if(KuKaRsiUdpServerInstance != nullptr){
        return true;
    }
    else{
        return false;
    }
}

short COM_ComKuKaRsiUdpServerInstanceInit(){
    if(KuKaRsiUdpServerInstance == nullptr){
        KuKaRsiUdpServerInstance = new KuKaRsiUdpServerDLL();
        return 1;
    }
    return 0;
}
short COM_ComKuKaRsiUdpServerInstanceRelease(){
    if(KuKaRsiUdpServerInstance != nullptr){
        delete KuKaRsiUdpServerInstance;
        KuKaRsiUdpServerInstance = nullptr;
        return 1;
    }
    return 0;
}

short COM_KuKaRsiUdpSendData(){
    if(KuKaRsiUdpServerInstance != nullptr){
        KuKaRsiUdpServerInstance->UdpWriteData();
        return 1;
    }
    return 0;
}

short COM_KuKaRsiUdpReadData(){
    if(KuKaRsiUdpServerInstance != nullptr){
        KuKaRsiUdpServerInstance->UdpReadData();
        return 1;
    }
    return 0;
}

short COM_KuKaDataWrite(QByteArray Data){
    if(KuKaRsiUdpServerInstance != nullptr){
        KuKaRsiUdpServerInstance->KuKaDataWrite(Data);
    }
    return 1;
}
short COM_KuKaDataRead(bool& ReadDone,QByteArray& Data){
    if(KuKaRsiUdpServerInstance != nullptr){
        KuKaRsiUdpServerInstance->KuKaDataRead(ReadDone,Data);
    }
    return 1;
}
